interface EnvironmentConfig {
  VITE_BASE_API: string
}

const ENVIRONMENT_CONFIG: Record<string, EnvironmentConfig> = {
  dev: { VITE_BASE_API: 'api' },
  test: { VITE_BASE_API: '/api' },
  pre: { VITE_BASE_API: '/api' },
  prod: { VITE_BASE_API: '/api' }
}

export default (env: string = 'dev'): EnvironmentConfig | void => {
  const config = ENVIRONMENT_CONFIG[env]

  if (config) {
    return config
  } else {
    uni.showModal({
      content: '未知环境，请联系管理员！'
    })
  }
}
